package com.flaskpy.web.eternity.core.exception;

import cn.hutool.core.annotation.AnnotationUtil;
import com.flaskpy.web.eternity.core.annotation.ExceptionGroup;
import com.flaskpy.web.eternity.core.exception.abs.IExceptionEnum;

/**
 * 错误代码生成
 */
public class ExpCodeFactory {
    public  static  String generate(IExceptionEnum iExceptionEnum){
        ExceptionGroup anno = AnnotationUtil.getAnnotation(iExceptionEnum.getClass(), ExceptionGroup.class);
        String g=anno.value();
        String c=iExceptionEnum.getCode();
        return g+c;
    }
    public  static  String generate(BizException bizException){
        return  generate(bizException.getExceptionEnum());
    }
}
